<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%--<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">--%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
<script type="text/javascript" src="bootstrap/js/jquery-3.2.1.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="bootstrap/js/bootbox.js"></script>
<script type="text/javascript" >
	$(function() {
		//给折旧按钮注册一个单击事件
		$('#btn-depreciation').click(function() {
			//发送折旧请求
			$.post("prdServlet",{'flag':'depreciation'},function(data){
				//判断data不为空的情况下
				if(data){
					//json字符串->对象
					var obj=eval("("+data+")");
					//判断
					if (obj.result==1) {
						//弹出msg
						bootbox.alert("资产折旧成功!")
					} else if(obj.result==0) {
						//弹出msg
						bootbox.alert("资产折旧失败!")
					}
				}
			});
		});
	});
</script>
</head>
<body>
	<h2>资产报废</h2>
	每年折旧25%,四年这个机器就报废了!<br>
	<button class="btn btn-default" id="btn-depreciation">
		<span class="glyphicon glyphicon-wrench aria-hidden=true"></span>
		资产折旧
	</button> 
</body>
</html>